<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>接龙房间列表</title>
    <meta name="keywords" content="接龙房间列表">
    <meta name="description" content="接龙房间列表">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="/state/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/state/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/state/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/state/css/animate.min.css" rel="stylesheet">
    <link href="/state/css/style.min.css?v=4.1.0" rel="stylesheet">
    <script src="/state/js/layer/layer.js" type="text/javascript" charset="utf-8" async defer></script>
    <link rel="stylesheet" type="text/css" href="/state/js/layer/skin/default/layer.css">

    <style>
        .table-responsive div{
            text-align: right;
        }
        .spiner-example{
            display: none;
        }
    </style>
    <style type="text/css" media="screen">
        .table>tbody>tr>td{
            text-align: center;
        }
        .table>thead>tr>th{
            text-align: center;
        }
    </style>

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>接龙房间列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <form name="adminchy_list" action="/adminchy/Room/solitaireRoomList" method="get">
                            <div class="col-sm-6">
                                <div class="input-group">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn btn-sm btn-primary" data-toggle="dropdown">
                                            <span id="user-search-type-name">搜索信息</span>
                                        </button>
                                    </div>
                                    <!--<input type="hidden" id="user-search-type" value="account" name="type">-->
                                    <input type="text" placeholder="房间名称"  class="input-sm form-control"  name="search" id="search" value="{$search}"> <span class="input-group-btn">
                                <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <div class="table-responsive">
                        <table class="table table-bordered table table-hover">
                            <thead>
                            <tr>
                                <th>房间ID</th>
                                <th>房间名称</th>
                                <th>规则</th>
                                <th>说明</th>
                                <th>单包金额</th>
                                <th>红包份数</th>
                                <th>红包过期时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="list_content">
                            {volist name="roomList" id="vo"}
                            <tr>
                                <td>{$vo.room_id}</td>
                                <td>{$vo.room_name}</td>
                                <td>{$vo.gold_range}</td>
                                <td>{$vo.game_intro}</td>
                                <td>{$vo.money}</td>
                                <td>{$vo.pocket}</td>
                                <td>{$vo.term}</td>
                                <td>
                                    <a href="javascript:;" class="btn btn-primary btn-xs" onclick="(addPrize({$vo.room_id}))"><i class="glyphicon glyphicon-plus"></i> 添加奖励设置</a> &nbsp;&nbsp;
                                    <a href="javascript:;" class="btn btn-primary btn-xs" onclick="(solitaireEditRoom({$vo.room_id}))"><i class="fa fa-paste"></i> 编辑</a> &nbsp;&nbsp;
                                    <a  class="btn btn-danger btn-xs" onclick="(del({$vo.room_id}))"><i class="fa fa-trash-o"></i> 删除</a></td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        <!-- 分页 -->
                        {$roomList|raw}

                    </div>
                    <div class="spiner-example">
                        <div class="sk-spinner sk-spinner-three-bounce">
                            <div class="sk-bounce1"></div>
                            <div class="sk-bounce2"></div>
                            <div class="sk-bounce3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/state/js/jquery.min.js"></script>
<script src="/state/js/bootstrap.min.js"></script>
<script src="/state/js/plugins/layer/layer.min.js"></script>
<script src="/state/js/plugins/laypage/laypage.js"></script>
<script src="/state/js/plugins/laytpl/laytpl.js"></script>
<script src="/state/js/common.js"></script>
<script>

    // 搜索
    function onclickme(page,type)
    {
        var action = $('#search').val();
        location.href=('/adminchy/Room/solitaireRoomList?page='+page+'&search='+action);
    }

    // 房间奖励设置
    function addPrize(id)
    {
        layer.open({
            type: 2,
            title: '奖励设置',
            area: ['100%', '100%'],
            content: 'addPrize/room_id/'+id,
        });
    }

     //修改房间
    function solitaireEditRoom(id)
    {
        layer.open({
            type: 2,
            title: '房间信息',
            area: ['100%', '100%'],
            content: 'solitaireRoomInfo/room_id/'+id,
        });
    }


    //修改  房间的基本状态
    function changeState(id){
        var objState = $('#state'+id);
        $.post("/adminchy/User/edit_status",{id:id},function(e){
            if(e.state > 0 ){
                layer.msg(e.message, {icon: 5});
            }else{
                if(e.data == 0){
                    layer.msg(e.message, {icon: 6});
                    objState.removeClass('label-primary').addClass('label-danger').html('冻结');
                }else{
                    layer.msg(e.message, {icon: 6});
                    objState.removeClass('label-danger').addClass('label-primary').html('正常');
                }
            }
        })
    }

    //修改信息
    function modify(id){
        location.href = '/adminchy/User/modify?id='+id;
    }

    //删除
    function del(room_id){
        layer.confirm('是否真的删除该房间(谨慎操作)？', {
            btn: ['确定','取消']
        }, function(){
            $.post("/adminchy/Room/delete_room",{room_id:room_id},function(data){
                if(data.status == 0){
                    layer.msg(data.message, {icon: 6,time:1000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(data.message, {icon: 5,time:1000},function(){
                        window.location.reload();
                    });
                }

            });
        });
    }

</script>
</body>
</html>
